﻿using UnityEngine;
using System.Collections;
using facepp.detection;

public class Demo : MonoBehaviour {

	// Use this for initialization
	void Start () {
		return;
		//detect api;
		Facepp_detect.instance.api_key="your api_key";
		Facepp_detect.instance.api_secret="your api_secret";
		//通过图片URL反悔信息
	    FaceDetectData detect_data=Facepp_detect.instance.getFaceDetectData("图片url");

		//byte[] byt=图片二进制
		//FaceDetectData detect_data=Facepp_detect.instance.getFaceDetectData(byt);
		Debug.Log("检测出的人脸数量: "+detect_data.faces.Count);
		if(detect_data.faces.Count>0){
			Face f=detect_data.faces[0];
			Debug.Log("大约年龄: "+f.attribute.age.value);
		}


		Facepp_landmark.instance.api_key="your api_key";
		Facepp_landmark.instance.api_secret="your api_secret";
		FaceLandMarkData landmark_data=Facepp_landmark.instance.getLandMarkDataFromDetect("图片URL");

		//同样提供了二进制方法
		//byte[] byt=图片二进制
		//FaceLandMarkData landmark_data=Facepp_landmark.instance.getLandMarkDataFromDetect(byt);

	//	Debug.Log(landmark_data.landmark.getP(LandMarkType.LEFT_EYE_PUPIL).x+"X"+landmark_data.landmark.getP(LandMarkType.LEFT_EYE_PUPIL).y);//获取左眼瞳孔位置;


	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
